import Vue from "vue";
import VueRouter from "vue-router";


Vue.use(VueRouter);

const routes = [
    //彭海鑫路由
    {
        // 编辑资料
        path: '/userUpdate',
        name: "userUpdate",
        component: () => import("../views/UserUpdate.vue"),
        meta: {
            title: "编辑资料"
        },
    },
    {
        // 设置
        path: '/setting',
        name: "setting",
        component: () => import("../views/Setting.vue"),
        meta: {
            title: "设置"
        },
    },
    {
        // 修改密码
        path: '/passwordUpdate',
        name: "passwordUpdate",
        component: () => import("../views/PasswordUpdate.vue"),
        meta: {
            title: "修改密码"
        },
    },
    {
        //个人主页
        path: '/homePage',
        name: "homePage",
        component: () => import("../views/HomePage.vue"),
        meta: {
            title: "个人主页"
        },
    },
    //张雨曦路由
    {
        //聊天
        path: "/chat",
        name: "chat",
        component: () => import("../views/Chat.vue"),
        meta: {
            title: "聊天"
        },
    },
    {
        //消息
        path: "/message",
        name: "message",
        component: () => import("../views/Message.vue"),
        meta: {
            title: "消息列表"
        },
    },
    //李佳路由
    {
        //广场
        path: "/ground",
        name: "ground",
        component: () => import("../views/Ground.vue"),
        meta: {
            title: "广场"
        },
    },
    {
        //笔记详情
        path: "/noteDetail",
        name: "noteDetail",
        component: () => import("../views/NoteDetail.vue"),
        meta: {
            title: "笔记详情"
        },
    },
    //何钇岑路由
    {
        //发布
        path: "/publish",
        name: "publish",
        component: () => import("../views/Publish.vue"),
        meta: {
            title: "发布笔记"
        },
    },
    //孟傅红路由
    {
        //搜索
        path: '/search',
        name: "search",
        component: () => import("../views/Search.vue"),
        meta: {
            title: "搜索"
        },
    },
    {
        //搜索结果
        path: '/searchResult',
        name: "searchResult",
        component: () => import("../views/SearchResult.vue"),
        meta: {
            title: "搜索结果"
        },
    },
    {
        path: "/login",
        name: "login",
        component: () => import("../views/Login.vue"),
        meta: {
            title: "登录"
        },
    },
    {
        path: "/",
        name: "default",
        redirect: {
            name: "login"
        }
    },
    //刘中仕路由
    {
        path: "/admin",
        name: "admin",
        component: () => import("../views/Admin.vue"),
        redirect: {
            name: "user"
        },
        children: [
            {
                path: "user",
                name: "user",
                component: () => import("../views/User.vue"),
                meta: {
                    title: "后台页面"
                },
            },
            {
                path: "channel",
                name: "channel",
                component: () => import("../views/Channel.vue"),
                meta: {
                    title: "后台页面"
                },
            },
            {
                path: "message",
                name: "messageAdmin",
                component: () => import("../views/MessageControl.vue"),
                meta: {
                    title: "后台页面"
                },
            },
            {
                path: "statistics",
                name: "statistics",
                component: () => import("../views/Statistics.vue"),
                meta: {
                    title: "后台页面"
                },
            },
            {
                path: "note",
                name: "NoteControl",
                component: () => import("../views/NoteControl.vue"),
                meta: {
                    title: "后台页面"
                },
            },
        ],
    },
];

const router = new VueRouter({
    mode: "history",
    base: process.env.BASE_URL,
    routes,
});

export default router;
